/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 *
 * @author carlos
 */
public class Dao {

  private static final String driver = "org.apache.derby.jdbc.ClientDriver";
  private static final String username = "henrique";
  private static final String password = "javaweb";
  private static final String url = "jdbc:derby://localhost:1527/AV1";
  private static Connection conn = null;

  // Criando a conexão
  public static Connection getConnection() {
    if (conn == null) {
      try {
        Class.forName(driver);
        conn = DriverManager.getConnection(url, username, password);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return conn;
  }
  
}
